package cn.yoyo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Document("t_blog")
public class Blog {
    @Id
    private String id;
    private String userId; // 发表该博客的用户的id
    private String nickname;// 作者昵称
    private String typeId;// 博客类型
    private String title;// 标题
    private String digest;// 摘要
    private String contentId;// 主体内容的id
    private Integer audit = 1;// 审核状态 0:通过 1:待审核/未通过
    private String likeId;
    private Integer likes = 0;// 点赞数
    private String favouriteId;
    private Integer favouriteSum = 0;// 收藏数
    private Integer pageviews = 0;// 阅读量
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;// 发表时间

    public Blog() {
    }

    public Blog(String id, String userId, String nickname, String typeId, String title, String digest, String contentId, Integer audit, String likeId, Integer likes, String favouriteId, Integer favouriteSum, Integer pageviews, Date createTime) {
        this.id = id;
        this.userId = userId;
        this.nickname = nickname;
        this.typeId = typeId;
        this.title = title;
        this.digest = digest;
        this.contentId = contentId;
        this.audit = audit;
        this.likeId = likeId;
        this.likes = likes;
        this.favouriteId = favouriteId;
        this.favouriteSum = favouriteSum;
        this.pageviews = pageviews;
        this.createTime = createTime;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDigest() {
        return digest;
    }

    public void setDigest(String digest) {
        this.digest = digest;
    }

    public String getContentId() {
        return contentId;
    }

    public void setContentId(String contentId) {
        this.contentId = contentId;
    }

    public Integer getAudit() {
        return audit;
    }

    public void setAudit(Integer audit) {
        this.audit = audit;
    }

    public String getLikeId() {
        return likeId;
    }

    public void setLikeId(String likeId) {
        this.likeId = likeId;
    }

    public Integer getLikes() {
        return likes;
    }

    public void setLikes(Integer likes) {
        this.likes = likes;
    }

    public String getFavouriteId() {
        return favouriteId;
    }

    public void setFavouriteId(String favouriteId) {
        this.favouriteId = favouriteId;
    }

    public Integer getFavouriteSum() {
        return favouriteSum;
    }

    public void setFavouriteSum(Integer favouriteSum) {
        this.favouriteSum = favouriteSum;
    }

    public Integer getPageviews() {
        return pageviews;
    }

    public void setPageviews(Integer pageviews) {
        this.pageviews = pageviews;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Blog{" +
                "id='" + id + '\'' +
                ", userId='" + userId + '\'' +
                ", nickname='" + nickname + '\'' +
                ", typeId='" + typeId + '\'' +
                ", title='" + title + '\'' +
                ", digest='" + digest + '\'' +
                ", contentId='" + contentId + '\'' +
                ", audit=" + audit +
                ", likeId='" + likeId + '\'' +
                ", likes=" + likes +
                ", favouriteId='" + favouriteId + '\'' +
                ", favouriteSum=" + favouriteSum +
                ", pageviews=" + pageviews +
                ", createTime=" + createTime +
                '}';
    }
}
